//
//  UIView+Share.m
//  YiJuZhangShou2.0
//
//  Created by 冷悦 on 16/3/27.
//  Copyright © 2016年 Mr.X. All rights reserved.
//

#import "UIView+Share.h"
//#import <ShareSDK/ShareSDK.h>
//#import <ShareSDKUI/ShareSDK+SSUI.h>

@implementation UIView (Share)
- (void)shareWithContent:(NSString *)content Title:(NSString *)title shareURL:(NSString *)shareURL{
#ifndef kShareImageIcon
#define kShareImageIcon @"share.jpg"
#endif
    [self shareWithContent:content
                     Title:title
                  ImageURL:kShareImageIcon
                  shareURL:shareURL
              andImageType:NO];
}

//- (void)shareWithContent:(NSString *)content
//                   Title:(NSString *)title
//                ImageURL:(NSString *)imageURL
//                shareURL:(NSString *)shareURL
//            andImageType:(BOOL)isImageURL{
//    //1、创建分享参数
//    //（注意：图片必须要在Xcode左边目录里面，名称必须要传正确，如果要分享网络图片，可以这样传image参数 images:@[@"http://mob.com/Assets/images/logo.png?v=20150320"]）
//    NSArray *imageArray;
//    
//    if (isImageURL == YES) {
//        imageArray = @[imageURL];
//    } else {
//        imageArray = @[[UIImage imageNamed:imageURL]];
//    }
//    if (imageArray) {
//        NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];
//        DDLogInfo(@"分享内容：%@",content);
//        DDLogInfo(@"图片内容：%@",imageURL);
//        [shareParams SSDKSetupShareParamsByText:content
//                                         images:imageArray
//                                            url:[NSURL URLWithString:shareURL]
//                                          title:title
//                                           type:SSDKContentTypeAuto];
    
#ifndef kUIViewShareSuccess
#define kUIViewShareSuccess @"分享成功"
#endif
    
#ifndef kUIViewShareFailed
#define kUIViewShareFailed @"分享失败"
#endif
//    [ShareSDK showShareActionSheet:self
//                             items:nil
//                       shareParams:shareParams
//               onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) {
//                   switch (state) {
//                       case SSDKResponseStateSuccess:
//                       {
//                           UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:kUIViewShareSuccess
//                                                                               message:nil
//                                                                              delegate:nil
//                                                                     cancelButtonTitle:@"确定"
//                                                                     otherButtonTitles:nil];
//                           [alertView show];
//                           break;
//                       }
//                       case SSDKResponseStateFail:
//                       {
//                           UIAlertView *alert = [[UIAlertView alloc] initWithTitle:kUIViewShareFailed
//                                                                           message:[NSString stringWithFormat:@"%@",error]
//                                                                          delegate:nil
//                                                                 cancelButtonTitle:@"OK"
//                                                                 otherButtonTitles:nil, nil];
//                           [alert show];
//                           break;
//                       }
//                       default:
//                           break;
//                   }
//               }];
//    }
//}

@end
